<script setup>

import {goBack, goCommunity} from "../../tools/go";
import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";

const props = defineProps({
  title: {
    type: String,
    default: "系统导航",
  },
  defGoBack: {
    type: Boolean,
    default: true,
  },
  go: {
    type: Function,
    default: () => {
      goBack()
    }
  }
});


</script>

<template>
  <view class="header">
    <uni-icons class="goBack" type="left" color="#868e96" @click="go" ></uni-icons>
    <text class="title">{{ title }}</text>
    <view class="right">
      <slot></slot>
    </view>
  </view>
</template>

<style scoped lang="scss">
@use "../../static/css/main";
.header {
  @include main.useTheme() {
    .right{
      position: absolute;
      right: 30rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 44px;
    }
    .goBack{
      position: absolute;
      left: 35rpx;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .title {
      font-size: 4vw;
      font-weight: 500;
      color: main.getVal("one_lv_text_color");
      text-align: center;
      display: block;
    }
    padding: 20rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: main.getVal("primary_bg_color");
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
  }
}
</style>